package com.health.mapp.interImpl;

import java.util.Date;

import com.health.db.model.RegisterOrderTemp;
import com.health.db.model.UserCardJournal;
import com.health.db.model.UserCardList;
import com.health.db.service.user.IUserCardListService;



/**
 * 线程启动
 * 
 * @author HiRoad
 * 
 */

public class DelayUpdateUserCardJournal extends Thread {

	/**
	 * 线程启动
	 * 
	 * @author HiRoad
	 * 
	 */
	 	private UserCardJournal cardJournal;
		private RegisterOrderTemp orderInfo;
		UserCardList userCardList;
		private IUserCardListService cardService;

		public DelayUpdateUserCardJournal( UserCardJournal cardJournal,
				RegisterOrderTemp orderInfo,UserCardList userCardList,
				 IUserCardListService cardService) {
			super();
			this.cardJournal = cardJournal;
			this.orderInfo= orderInfo;
			this.userCardList = userCardList;
			this.cardService = cardService;
		}

		public void run() {
			delayUpdateOrder(cardJournal,orderInfo, userCardList, cardService);
		}
	/**
	 * 延时处理更新user表
	 */
	private void delayUpdateOrder(UserCardJournal cardJournal,RegisterOrderTemp orderInfoTemp,UserCardList userCardList,
			 IUserCardListService cardService
			) {
			
			cardJournal.setCardid(userCardList.getCardid());
			cardJournal.setOwnerid(userCardList.getOwnerid());
			cardJournal.setCarditemid((short)userCardList.getCardtypeid().intValue());
			cardJournal.setJournalDate(new Date());
			//cardJournal.setJournalDesc(orderInfoTemp.getOrderTypeDesc());
			//cardJournal.setGoodsid(orderInfoTemp.getGoodsid().intValue());
			cardJournal.setVoucherid(Long.valueOf(orderInfoTemp.getOrderId()));
			cardService.insertUserCardJournal(cardJournal);
		}
		

}